
<?php

echo session_status() ? 'open' : "close";

$temp_file  =  tempnam ( sys_get_temp_dir (),  'Tux' );

echo  $temp_file ;

echo "<p>123</p>";

echo dirname($temp_file);

echo "<p>123</p>";

$includePath = './vendor/autoload.php';
if (file_exists($includePath)) {
    include_once $includePath;
} else {
    function dump($str = null)
    {
        echo "<pre>";
        var_dump($str);
        echo "</pre>";
    }
}

dump(__FILE__);

dump(ini_get('date.timezone'));
dump(date('Y-m-d H:i:s'));
$dns = 'mysql';
$host = 'localhost';
$host = '127.0.0.1';
$host = 'mysql';
$dbName = 'mysql';
$user = 'root';
$password = 'root';
$dsn="$dns:host=$host;dbname=$dbName";

try {
    #$dbh = new PDO("mysql:host=localhost;dbname=$dbName", 'root', 'root');
    #$dbh = new PDO("mysql:host=127.0.0.1;dbname=$dbName", 'root', 'root');
    $db = new PDO("mysql:host=mysql;dbname=${dbName}", 'root', 'root');

    #$dbh = new PDO($dsn, $user, $password);
    var_dump($db);
    /*你还可以进行一次搜索操作
    foreach ($dbh->query('SELECT * from FOO') as $row) {
        print_r($row); //你可以用 echo($GLOBAL); 来看到这些值
    }
    */
    $dbh = null;
} catch (PDOException $e) {
    die ("Error!: " . $e->getMessage() . "<br/>");
}

$servername = "localhost";
$servername = "mysql";
$username = "root";
$password = "root";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";

//phpinfo();
